package com.wicket.okrbff.web.contorller;

import com.wicket.okrbff.biz.service.PowerService;
import com.wicket.okrbff.biz.service.dto.req.*;
import com.wicket.okrbff.biz.service.dto.res.*;
import com.wicket.okrbff.common.ro.OkrResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import com.wicket.okrframework.integration.FwBasePowerClient;
import com.wicket.okrframework.integration.dto.QueryPowerDetailRespDto;
import com.wicket.okrframework.integration.dto.QueryPowerDetailReqDto;
import com.wicket.okrbff.common.exception.Assert;
import com.wicket.okrframework.integration.dto.QueryTributPowerDeptListRespDto;
import com.wicket.okrframework.integration.dto.QueryTributPowerDeptListReqDto;
import com.wicket.okrbff.biz.service.dto.common.BffDeptDto;
import cn.hutool.core.bean.BeanUtil;
import java.util.stream.Collectors;
import com.wicket.okrframework.integration.dto.AddTributPowerRespDto;
import com.wicket.okrframework.integration.dto.AddTributPowerReqDto;
import com.wicket.okrframework.integration.dto.QueryTributPowerListRespDto;
import com.wicket.okrframework.integration.dto.QueryTributPowerListReqDto;
import com.wicket.okrframework.integration.FwBaseInductionRecordClient;
import com.wicket.okrframework.integration.dto.BatchQueryInductionRecordListComRespDto;
import com.wicket.okrframework.integration.dto.BatchQueryInductionRecordListComReqDto;
import cn.hutool.core.collection.CollectionUtil;
import com.wicket.okrframework.integration.dto.QueryTributPowerPositionListRespDto;
import com.wicket.okrframework.integration.dto.QueryTributPowerPositionListReqDto;
import com.wicket.okrbff.biz.service.dto.common.BffPositionDto;
import com.wicket.okrframework.integration.dto.QueryTributPowerMemberListRespDto;
import com.wicket.okrframework.integration.dto.QueryTributPowerMemberListReqDto;
import com.wicket.okrframework.integration.dto.QueryTributPowerRoleListRespDto;
import com.wicket.okrframework.integration.dto.QueryTributPowerRoleListReqDto;
import com.wicket.okrframework.integration.dto.QueryTributPowerInductionRecordListRespDto;
import com.wicket.okrframework.integration.dto.QueryTributPowerInductionRecordListReqDto;
import com.wicket.okrbff.biz.service.dto.common.BffPerOrgInductionRecordDto;
import com.wicket.okrframework.integration.dto.QueryTributPowerDeptPositionListRespDto;
import com.wicket.okrframework.integration.dto.QueryTributPowerDeptPositionListReqDto;
import com.wicket.okrframework.integration.dto.QueryTributPowerDetailRespDto;
import com.wicket.okrframework.integration.dto.QueryTributPowerDetailReqDto;
import com.wicket.okrframework.integration.dto.QueryTribuDeptPowerListRespDto;
import com.wicket.okrframework.integration.dto.QueryTribuDeptPowerListReqDto;
import com.wicket.okrbff.biz.service.dto.common.BffFrameworkPrivacyDto;
import com.wicket.okrframework.integration.dto.QueryManageDeptListBorderRespDto;
import com.wicket.okrframework.integration.dto.QueryManageDeptListBorderReqDto;
import com.wicket.okrframework.integration.dto.AddManageDeptRespDto;
import com.wicket.okrframework.integration.dto.AddManageDeptReqDto;
import com.wicket.okrframework.integration.dto.ArchiveTribuDeptPowerRespDto;
import com.wicket.okrframework.integration.dto.ArchiveTribuDeptPowerReqDto;
import com.wicket.okrframework.integration.dto.GetUserAllPowerRespDto;
import com.wicket.okrframework.integration.dto.GetUserAllPowerReqDto;
import com.wicket.okrbff.common.util.CommonFunctionHelper;
import com.wicket.okrframework.integration.dto.ArchiveTributPowerRespDto;
import com.wicket.okrframework.integration.dto.ArchiveTributPowerReqDto;
import com.wicket.okrframework.integration.dto.ArchiveTributPowerRedisRespDto;
import com.wicket.okrframework.integration.dto.ArchiveTributPowerRedisReqDto;
import com.wicket.okrframework.integration.dto.DeleteManageDeptRespDto;
import com.wicket.okrframework.integration.dto.DeleteManageDeptReqDto;
import com.wicket.okrframework.integration.FwBaseDivineDataClient;
import com.wicket.okrframework.integration.FwBaseRoleClient;
import com.wicket.okrframework.integration.dto.ImplementReceiveFieldComRespDto;
import com.wicket.okrframework.integration.dto.ImplementReceiveFieldComReqDto;
import com.wicket.okrframework.integration.dto.QueryRoleOfPowerListComRespDto;
import com.wicket.okrframework.integration.dto.QueryRoleOfPowerListComReqDto;
import com.wicket.okrframework.integration.dto.BatchQueryTributPowerComByObjRespDto;
import com.wicket.okrframework.integration.dto.BatchQueryTributPowerComByObjReqDto;
import com.wicket.okrbff.biz.service.dto.common.BffTributPowerDto;
import java.util.ArrayList;
import java.util.List;
import com.wicket.okrframework.integration.dto.QueryOneDeptTributPowerStaffListRespDto;
import com.wicket.okrframework.integration.dto.QueryOneDeptTributPowerStaffListReqDto;
import com.wicket.okrbff.biz.service.dto.common.BffOneDeptTributPowerStaffDto;
import com.wicket.okrbff.common.dto.TreeNode;
import com.wicket.okrframework.integration.dto.QueryCurrentStaffRolePowerListRespDto;
import com.wicket.okrframework.integration.dto.QueryCurrentStaffRolePowerListReqDto;
import com.wicket.okrbff.biz.service.dto.common.BffPowerCodeListDto;
import com.wicket.okrframework.integration.dto.QueryCurrentUserRecordTributPowerDetailComRespDto;
import com.wicket.okrframework.integration.dto.QueryCurrentUserRecordTributPowerDetailComReqDto;
import com.wicket.okrframework.integration.dto.QueryCurrentUserPowerListComRespDto;
import com.wicket.okrframework.integration.dto.QueryCurrentUserPowerListComReqDto;

/**
 * @author ：
 * @date ：
 *
 *
 * @version 1.0
 */
@Api(value = "Power", tags = {"Power"})
@RestController
// @RequestMapping("/oms/power/")
public class PowerController {

    @Autowired
    PowerService powerService;

    /**
   * B-检查权限（公共）
   * gen by moon at 8/10/2022, 3:37:11 AM
   */
    @PostMapping("/oms/power/checkPowerCom")
    @ApiOperation(value = "B-检查权限（公共）", response = OkrResult.class)
    public OkrResult<BffCheckPowerComRespDto> checkPowerCom(@RequestBody(required=false) @Validated BffCheckPowerComReqDto reqDTO){
        return OkrResult.success(powerService.checkPowerCom(reqDTO));
    }

    /**
   * B1-2新增管理的部门（管理）
   * gen by moon at 8/22/2022, 10:22:53 PM
   */
    @PostMapping("/oms/mgt/power/addManageDept")
    @ApiOperation(value = "B1-2新增管理的部门（管理）", response = OkrResult.class)
    public OkrResult<BffAddManageDeptRespDto> addManageDept(@RequestBody(required=false) @Validated BffAddManageDeptReqDto reqDTO){
        return OkrResult.success(powerService.addManageDept(reqDTO));
    }

    /**
   * B1-2查询管理的部门列表（管理）
   * gen by moon at 8/10/2022, 3:33:42 AM
   */
    @PostMapping("/oms/mgt/power/queryManageDeptList")
    @ApiOperation(value = "B1-2查询管理的部门列表（管理）", response = OkrResult.class)
    public OkrResult<BffQueryManageDeptListRespDto> queryManageDeptList(@RequestBody(required=false) @Validated BffQueryManageDeptListReqDto reqDTO){
        return OkrResult.success(powerService.queryManageDeptList(reqDTO));
    }

    /**
   * B1-2查询权限分配的角色列表（管理）
   * gen by moon at 8/10/2022, 3:32:38 AM
   */
    @PostMapping("/oms/mgt/power/queryTributPowerRoleList")
    @ApiOperation(value = "B1-2查询权限分配的角色列表（管理）", response = OkrResult.class)
    public OkrResult<BffQueryTributPowerRoleListRespDto> queryTributPowerRoleList(@RequestBody(required=false) @Validated BffQueryTributPowerRoleListReqDto reqDTO){
        return OkrResult.success(powerService.queryTributPowerRoleList(reqDTO));
    }

    /**
     * B1-2查询部门管理权限
     */
    @PostMapping("/oms/mgt/power/queryDeptPowerDetail")
    @ApiOperation(value = "B1-2查询部门管理权限", response = OkrResult.class)
    public OkrResult<BffQueryDeptPowerDetailRespDto> queryDeptPowerDetail(@RequestBody(required = false) @Validated BffQueryDeptPowerDetailReqDto reqDTO) {
        return OkrResult.success(powerService.queryDeptPowerDetail(reqDTO));
    }

    /**
   * B1-存档权限分配（管理）（公共）
   * gen by moon at 8/22/2022, 10:22:55 PM
   */
    @PostMapping("/oms/mgt/power/archiveTributPowerCom")
    @ApiOperation(value = "B1-存档权限分配（管理）（公共）", response = OkrResult.class)
    public OkrResult<BffArchiveTributPowerComRespDto> archiveTributPowerCom(@RequestBody(required=false) @Validated BffArchiveTributPowerComReqDto reqDTO){
        return OkrResult.success(powerService.archiveTributPowerCom(reqDTO));
    }

    /**
   * B1-2存档部门权限分配（管理）
   * gen by moon at 10/15/2022, 5:53:23 PM
   */
    @PostMapping("/oms/mgt/power/archiveTribuDeptPower")
    @ApiOperation(value = "B1-2存档部门权限分配（管理）", response = OkrResult.class)
    public OkrResult<BffArchiveTribuDeptPowerRespDto> archiveTribuDeptPower(@RequestBody(required=false) @Validated BffArchiveTribuDeptPowerReqDto reqDTO){
        return OkrResult.success(powerService.archiveTribuDeptPower(reqDTO));
    }

    /**
   * B1-2查询权限分配列表（管理边界）
   * gen by moon at 10/23/2022, 2:36:40 PM
   */
    @PostMapping("/oms/mgt/power/queryTributPowerListBorder")
    @ApiOperation(value = "B1-2查询权限分配列表（管理边界）", response = OkrResult.class)
    public OkrResult<BffQueryTributPowerListBorderRespDto> queryTributPowerListBorder(@RequestBody(required=false) @Validated BffQueryTributPowerListBorderReqDto reqDTO){
        return OkrResult.success(powerService.queryTributPowerListBorder(reqDTO));
    }

    /**
   * B1-2查询分配的部门权限列表（管理）
   * gen by moon at 8/22/2022, 10:22:52 PM
   */
    @PostMapping("/oms/mgt/power/queryTribuDeptPowerList")
    @ApiOperation(value = "B1-2查询分配的部门权限列表（管理）", response = OkrResult.class)
    public OkrResult<BffQueryTribuDeptPowerListRespDto> queryTribuDeptPowerList(@RequestBody(required=false) @Validated BffQueryTribuDeptPowerListReqDto reqDTO){
        return OkrResult.success(powerService.queryTribuDeptPowerList(reqDTO));
    }

    /**
   * B1-2查询权限分配详情(管理)
   * gen by moon at 8/10/2022, 3:32:50 AM
   */
    @PostMapping("/oms/mgt/power/queryTributPowerDetail")
    @ApiOperation(value = "B1-2查询权限分配详情(管理)", response = OkrResult.class)
    public OkrResult<BffQueryTributPowerDetailRespDto> queryTributPowerDetail(@RequestBody(required=false) @Validated BffQueryTributPowerDetailReqDto reqDTO){
        return OkrResult.success(powerService.queryTributPowerDetail(reqDTO));
    }

    /**
   * B1-2查询权限分配的部门职务列表（管理）
   * gen by moon at 8/10/2022, 3:32:46 AM
   */
    @PostMapping("/oms/mgt/power/queryTributPowerDeptPositionList")
    @ApiOperation(value = "B1-2查询权限分配的部门职务列表（管理）", response = OkrResult.class)
    public OkrResult<BffQueryTributPowerDeptPositionListRespDto> queryTributPowerDeptPositionList(@RequestBody(required=false) @Validated BffQueryTributPowerDeptPositionListReqDto reqDTO){
        return OkrResult.success(powerService.queryTributPowerDeptPositionList(reqDTO));
    }

    /**
   * B1-2查询权限分配的部门成员列表（管理）
   * gen by moon at 8/22/2022, 10:22:51 PM
   */
    @PostMapping("/oms/mgt/power/queryTributPowerInductionRecordList")
    @ApiOperation(value = "B1-2查询权限分配的部门成员列表（管理）", response = OkrResult.class)
    public OkrResult<BffQueryTributPowerInductionRecordListRespDto> queryTributPowerInductionRecordList(@RequestBody(required=false) @Validated BffQueryTributPowerInductionRecordListReqDto reqDTO){
        return OkrResult.success(powerService.queryTributPowerInductionRecordList(reqDTO));
    }

    /**
   * B1-2查询权限分配的员工列表（管理）
   * gen by moon at 10/23/2022, 12:09:09 AM
   */
    @PostMapping("/oms/mgt/power/queryTributPowerMemberList")
    @ApiOperation(value = "B1-2查询权限分配的员工列表（管理）", response = OkrResult.class)
    public OkrResult<BffQueryTributPowerMemberListRespDto> queryTributPowerMemberList(@RequestBody(required=false) @Validated BffQueryTributPowerMemberListReqDto reqDTO){
        return OkrResult.success(powerService.queryTributPowerMemberList(reqDTO));
    }

    /**
   * B1-2查询权限分配的职务列表（管理）
   * gen by moon at 10/23/2022, 12:09:07 AM
   */
    @PostMapping("/oms/mgt/power/queryTributPowerPositionList")
    @ApiOperation(value = "B1-2查询权限分配的职务列表（管理）", response = OkrResult.class)
    public OkrResult<BffQueryTributPowerPositionListRespDto> queryTributPowerPositionList(@RequestBody(required=false) @Validated BffQueryTributPowerPositionListReqDto reqDTO){
        return OkrResult.success(powerService.queryTributPowerPositionList(reqDTO));
    }

    /**
   * B1-2查询权限分配列表（管理）
   * gen by moon at 8/24/2022, 9:19:09 PM
   */
    @PostMapping("/oms/mgt/power/queryTributPowerList")
    @ApiOperation(value = "B1-2查询权限分配列表（管理）", response = OkrResult.class)
    public OkrResult<BffQueryTributPowerListRespDto> queryTributPowerList(@RequestBody(required=false) @Validated BffQueryTributPowerListReqDto reqDTO){
        return OkrResult.success(powerService.queryTributPowerList(reqDTO));
    }

    /**
   * B1-2新增权限分配（管理）
   * gen by moon at 8/24/2022, 10:43:58 PM
   */
    @PostMapping("/oms/mgt/power/addTributPower")
    @ApiOperation(value = "B1-2新增权限分配（管理）", response = OkrResult.class)
    public OkrResult<BffAddTributPowerRespDto> addTributPower(@RequestBody(required=false) @Validated BffAddTributPowerReqDto reqDTO){
        return OkrResult.success(powerService.addTributPower(reqDTO));
    }

    /**
   * B1-2查询权限分配的部门列表（管理）
   * gen by moon at 10/23/2022, 12:09:04 AM
   */
    @PostMapping("/oms/mgt/power/queryDeptTributPowerList")
    @ApiOperation(value = "B1-2查询权限分配的部门列表（管理）", response = OkrResult.class)
    public OkrResult<BffQueryDeptTributPowerListRespDto> queryDeptTributPowerList(@RequestBody(required=false) @Validated BffQueryDeptTributPowerListReqDto reqDTO){
        return OkrResult.success(powerService.queryDeptTributPowerList(reqDTO));
    }

    /**
   * B1-2查询权限详情（管理）
   * gen by moon at 8/10/2022, 3:32:10 AM
   */
    @PostMapping("/oms/mgt/power/queryPowerDetail")
    @ApiOperation(value = "B1-2查询权限详情（管理）", response = OkrResult.class)
    public OkrResult<BffQueryPowerDetailRespDto> queryPowerDetail(@RequestBody(required=false) @Validated BffQueryPowerDetailReqDto reqDTO){
        return OkrResult.success(powerService.queryPowerDetail(reqDTO));
    }
/**
   * B1-2-14删除管理的部门(管理)
   * gen by moon at 9/16/2022, 5:19:37 AM
   */
    @PostMapping("/oms/mgt/power/deleteManageDept")
    @ApiOperation(value = "B1-2-14删除管理的部门(管理)", response = OkrResult.class)
    public OkrResult<BffDeleteManageDeptRespDto> deleteManageDept(@RequestBody(required=false) @Validated BffDeleteManageDeptReqDto reqDTO){
        return OkrResult.success(powerService.deleteManageDept(reqDTO));
    }
/**
   * B1-2判断权限分配可用
   * gen by moon at 9/17/2022, 8:08:46 AM
   */
    @PostMapping("/oms/power/judgeTributPowerUsable")
    @ApiOperation(value = "B1-2判断权限分配可用", response = OkrResult.class)
    public OkrResult<BffJudgeTributPowerUsableRespDto> judgeTributPowerUsable(@RequestBody(required=false) @Validated BffJudgeTributPowerUsableReqDto reqDTO){
        return OkrResult.success(powerService.judgeTributPowerUsable(reqDTO));
    }
/**
   * B1查询一级部门下分配权限人员列表(管理)
   * gen by moon at 11/7/2022, 7:36:10 PM
   */
    @PostMapping("/oms/mgt/power/queryOneDeptTributPowerStaffList")
    @ApiOperation(value = "B1查询一级部门下分配权限人员列表(管理)", response = OkrResult.class)
    public OkrResult<BffQueryOneDeptTributPowerStaffListRespDto> queryOneDeptTributPowerStaffList(@RequestBody(required=false) @Validated BffQueryOneDeptTributPowerStaffListReqDto reqDTO){
        return OkrResult.success(powerService.queryOneDeptTributPowerStaffList(reqDTO));
    }
/**
   * B1-2查询当前员工角色权限列表
   * gen by moon at 1/19/2023, 4:23:18 AM
   */
    @PostMapping("/oms/power/queryCurrentStaffRolePowerList")
    @ApiOperation(value = "B1-2查询当前员工角色权限列表", response = OkrResult.class)
    public OkrResult<BffQueryCurrentStaffRolePowerListRespDto> queryCurrentStaffRolePowerList(@RequestBody(required=false) @Validated BffQueryCurrentStaffRolePowerListReqDto reqDTO){
        return OkrResult.success(powerService.queryCurrentStaffRolePowerList(reqDTO));
    }
/**
   * B1查询当前用户就职记录权限
   * gen by moon at 6/28/2023, 8:47:31 PM
   */
    @PostMapping("/oms/power/queryCurrentUserRecordTributPowerDetail")
    @ApiOperation(value = "B1查询当前用户就职记录权限", response = OkrResult.class)
    public OkrResult<BffQueryCurrentUserRecordTributPowerDetailRespDto> queryCurrentUserRecordTributPowerDetail(@RequestBody(required=false) @Validated BffQueryCurrentUserRecordTributPowerDetailReqDto reqDTO){
        return OkrResult.success(powerService.queryCurrentUserRecordTributPowerDetail(reqDTO));
    }


}
